local ClientOHOH = _G.ClientOHOH;
local M = ClientOHOH.class.new(script, ClientOHOH.files.Client_PlayerComponent(),"HomeButton_"..script.Name);
local HomeGui= ClientOHOH.load.UIManager().ui_list.HomeGui

function M.new(self,...)
	return M(self,...);
end;

function M.ctor(self, parent)
	M.super.ctor(self, parent);

    self:HideButton()

	self.DataStore=self.parent:GetComponent(_G.ClientOHOH.load.Client_PlayerDataComponent())

    self.ConList={}

    local con= self.parent.UserDataEvent:Connect(function(data)
		if data["bro"] then
			self:UpdData(self.DataStore:GetData("bro"))
		end
	end)

    table.insert(self.ConList,con)


    self:UpdData(self.DataStore:GetData("bro"))

    
end;

function M.HideButton(self)

    HomeGui.insts.FriendEquip.button.Visible=false
end

function M.ShowButton(self)
    HomeGui.insts.FriendEquip.button.Visible=true
    self:dtor()
end

function M.UpdData(self,data)
    for k,v in pairs(data.had) do
        self:ShowButton()
        return 
    end

    for k,v in pairs(data.equip) do
        self:ShowButton()
        return 
    end
end



function M.dtor(self)
    for k,v in pairs(self.ConList) do
       v:Disconnect()
    end
    self.ConList={}
   M.super.dtor(self);
end;

return M